/*
 * TransactionDetail.java
 *
 *  
 */
package org.msb.finance.data;

import java.math.BigDecimal;

/**
 * 
 * 
 * @author Marc
 * 
 */
public abstract class TransactionDetail {

	/*
	 * 
	 */
	private Category category;

	/*
	 * 
	 */
	private Individual individual;

	/*
	 * 
	 */
	private String memo;

	/**
	 * 
	 * @return
	 */
	public abstract BigDecimal getAmount();

	/**
	 * 
	 * @return
	 */
	public Category getCategory() {
		return this.category;
	}

	/**
	 * 
	 * @param category
	 */
	public void setCategory(Category category) {
		this.category = category;
	}

	/**
	 * 
	 * @return
	 */
	public Individual getIndividual() {
		return this.individual;
	}

	/**
	 * 
	 * @param individual
	 */
	public void setIndividual(Individual individual) {
		this.individual = individual;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (obj instanceof TransactionDetail) {
			TransactionDetail td = (TransactionDetail) obj;
			return (getAmount().equals(td.getAmount()))
					&& (null == this.category ? null == td.category : this.category.equals(td.category))
					&& (null == this.individual ? null == td.individual : this.individual.equals(td.individual));
		}

		return false;
	}

}
